home *** CD-ROM | disk | FTP | other *** search
- From: jdmorris@ix.netcom.com (Jason D. Morris)
- Message-ID: <3161eaa4.8216104@nntp.ix.netcom.com>
- X-Original-Date: Wed, 03 Apr 1996 03:10:16 GMT
- Path: in2.uu.net!bounce-back
- Date: 03 Apr 96 03:28:27 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: constness of private members and methods
- Organization: Netcom
- References: <m0u3992-000GcEC@7.kurahaupo.gen.nz>
- X-Netcom-Date: Tue Apr 02 9:10:18 PM CST 1996
- X-Newsreader: Forte Agent .99d/32.182
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMWHwiuEDnX0m9pzZAQEZEQF/SdEOhOpnn4JH2fPLzr4lSku+g0vceN3N
- gSeL1gJBH4dvDA5Q+3Q7W24eng7r7Noq
- =HE2i
-
- On 01 Apr 1996 10:39:46 PST, martin@kcbbs.gen.nz (Martin D Kealey)
- wrote:
-
- >What are needed (to allow some function calls to be optimised
- >away) are two new keywords:
- >
- > * "clean" which guarantees that the function doesn't modify
- > objects that can only be reached as or through names
- > in an outer scope - and in turn will not call any non-clean
- > functions; and
- >
- > * "pure" which guarantees that the function does not depend on
- > the value of any outer scope object - and in turn will not
- > call any non-pure function;
- >
- >To be fully useful, a function would be declared with both of
- >these attibutes and with all pointer or reference parameters
- >(including "this") declared "const".
- >
- >Anyone care to put this forward, or has it been discussed before?
-
- Assuming you allow 'pure' and 'clean', the compiler would then have
- to check to make sure your functions were in fact 'pure' and 'clean'.
- If the compiler could do such checking as part of its array of
- optimizations, why not just do it for every function as
- part of a general optimization step? If the compiler were to do
- no checking for the adherence to 'pure' and 'clean' modifiers, then
- such modifiers would essentially be a gentleman's contract. Such
- a "contract" could be freely violated with potentially disastrous
- results; essentially making 'pure' and 'clean' meaningless.
-
- Jason
- ---
- [ comp.std.c++ is moderated. To submit articles: try just posting with ]
- [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
- [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
- [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
- [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
-